1# application/models/detection/product_model.py
from sqlalchemy import Column, BigInteger, String, ForeignKey
from application.models.base import Base
from sqlalchemy.orm import relationship

class Product(Base):
    """产品型号数据模型"""
    
    __tablename__ = "detection_product"
    
    # 主键
    product_id = Column(BigInteger, primary_key=True, comment="产品ID")
    
    # 外键关联产品型号
    product_model_id = Column(BigInteger, ForeignKey('detection_product_model.product_model_id'), comment="产品型号ID")
    # 产品信息
    product_name= Column(String(30), comment="产品名称")
    product_no = Column(String(30), comment="产品编号")
    contract_name = Column(String(30), comment="合同名称")

     # 关联产品型号
    model = relationship("ProductModel", back_populates="products")
  
    # 表注释
    __table_args__ = {"comment": "产品型号表"}